package org.thanos.demo.service.role;

import org.apache.shiro.lang.util.Assert;
import org.springframework.stereotype.Service;
import org.thanos.demo.entity.SysRoleMenu;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

@Service("sysRoleMenuService")
public class SysRoleMenuServiceImpl implements SysRoleMenuService {

    @Override
    public List<Integer> selectByRoleId(Integer roleId) {
        Assert.isTrue(Objects.nonNull(roleId));
        return SysRoleMenu.data().stream().filter(sysRoleMenu -> sysRoleMenu.getRoleId().equals(roleId)).map(SysRoleMenu::getMenuId).collect(Collectors.toList());
    }
}
